VB5 Control Creation Edition
Marquee ActiveX Control
| Home | Site Map |

 

The scrolling text below is displayed using a marquee control created with the Control Creation Edition of Visual Basic 5.0. The buttons below can be used to change the operation of the control.

Message Text
Scroll Mode
Start / Stop


The Marquee Control Explained

The Marquee control on this page is scripted with VBScript code. The text below explains how the VBScript code manipulates the Marquee control.

The Text Property
The string displayed by the marquee control is held in the control's Text property. To display a new string, the VBScript code changes the Text property, and then sets the Scrolling property to True so the control will update itself. The code fires when the page is loaded and when the Change Text button is pressed.

	
	Sub btnChange_onClick
		Marquee.Text = txtMsg.Value
		Marquee.Scrolling = True
	End Sub
The ScrollMode Property
The marquee control also exposes a property called ScrollMode that allows the scrolling direction to be modified. When the control has a ScrollMode value of 0, the text scrolls from right to left. When the control has a ScrollMode value of 1, the text scrolls from left to right.

This code toggles the ScrollMode and updates the button with the correct direction. Pressing the "Scroll Mode" button fires code that toggles the ScrollMode property and updates the button's text:

	
	Sub btnScrollMode_onClick
		If Marquee.ScrollMode = 0 Then
			Marquee.Scrolling = False
			Marquee.ScrollMode = 1
			Marquee.Scrolling = True
			btnScrollMode.Value = "Right to Left"
		Else
			Marquee.Scrolling = False
			Marquee.ScrollMode = 0
			Marquee.Scrolling = True
			btnScrollMode.Value = "Left to Right"
		End If
	End Sub
The Scrolling Property
The Scrolling property is used to stop and start scrolling. The VBScript code in this web page starts and stops scrolling when the 'Start/Stop' button is pressed:
	
	Sub btnStartStop_onClick
		If Marquee.Scrolling Then
			Marquee.Scrolling = False
			btnStartStop.Value = "Start"
		Else
			Marquee.Scrolling = True
			btnStartStop.Value = "Stop"
		End If
	End Sub